<h5><i class="icon-globe"></i> <?=  $t_titulo_meteorologia; ?></h5>


<ul id="myTab" class="nav nav-tabs">
    
    <li class="active">
        <a data-toggle="tab" href="#meteoro1"><?=  $t_titulo_itens; ?></a>
    </li>
    
    <li>
        <a data-toggle="tab" href="#meteoro2"><?=  $t_titulo_cores_meteorologicas; ?></a>
    </li>
    
    <li>
        <a data-toggle="tab" href="#meteoro3"><?=  $t_titulo_cores_campo; ?></a>
    </li>
    
</ul>

<div id="myTabContent" class="tab-content">
    
    <div id="meteoro1" class="tab-pane fade active in">
        
        <p>
           
            <!-- Atualiza&ccedil;&atilde;o meteorol&oacute;gica -->
            <div>
    
                <div id="met_esq">
                    <?= $t_atualiza; ?>
                    <?php 
                    $sql_met = "SELECT met_data,met_hora FROM meteoro ORDER BY met_data DESC";
                    $res_met = sql($sql_met);
                    $linha_met = mysql_fetch_array($res_met);
                    echo "<striong>".todatabr($linha_met['met_data'])."</strong>&nbsp;&nbsp;{$linha_met['met_hora']} Z";
                    ?>
                    <hr>
                </div>

                <div id="met_dir"><img src="midia/base/meteoro.png" align="absmiddle"></div>

            </div>

        
            <!-- Listagem de documentos -->
            <div>
    
                <ul id="browser" class="filetree">

                    <?php
                    $sql_raiz = "SELECT * FROM meteoroarea WHERE status='1' ORDER BY met_are_nome";
                    $res_raiz = sql($sql_raiz);
                    while($linha_raiz = mysql_fetch_array($res_raiz)) {
                    ?>
                    <li class="closed ">

                        <span class="folder"><?=$linha_raiz['met_are_nome'];?></span>

                        <ul>

                            <?php
                            $sql_sub2 = "SELECT * FROM meteoroarea WHERE status='1' AND met_are_id='{$linha_raiz['met_are_id2']}' ORDER BY met_are_nome";
                            $res_sub2 = sql($sql_sub2);
                            while($linha_sub2 = mysql_fetch_array($res_sub2)) {
                            ?>
                            <li>

                                <span class="folder"><?=$linha_sub2['met_are_nome'];?></span>

                                <ul>

                                    <?php
                                    $sql_sub3 = "SELECT * FROM meteoroarea WHERE status='1' AND met_are_id='{$linha_sub2['met_are_id2']}' ORDER BY met_are_nome";
                                    $res_sub3 = sql($sql_sub3);
                                    while($linha_sub3 = mysql_fetch_array($res_sub3)) {
                                    ?>
                                    <li><span class="folder"><?=$linha_sub3['met_are_nome'];?></span>

                                        <ul id="folder21">

                                            <?php
                                            $sql_file3 = "SELECT * FROM meteoro WHERE status='1' AND met_are_id='{$linha_sub3['met_are_id2']}' ORDER BY met_id DESC";
                                            $res_file3 = sql($sql_file3);
                                            while($linha_file3 = mysql_fetch_array($res_file3)) {
                                            ?>
                                                <li><span class="service"><a href="<?=$linha_file3['met_url'];?>" target="_blank"><?="{$linha_file3['met_nome']} - <b>".todatabr($linha_file3['met_data'])."</b>&nbsp;&nbsp;-&nbsp;&nbsp;{$linha_file3['met_hora']} Z";?></a></span></li>
                                            <?php
                                            }
                                            ?>

                                        </ul>

                                    </li>
                                <? 
                                }

                                $sql_file2 = "SELECT * FROM meteoro WHERE status='1' AND met_are_id='{$linha_sub2['met_are_id']}' ORDER BY met_id DESC";
                                $res_file2 = sql($sql_file2);
                                while($linha_file2 = mysql_fetch_array($res_file2)) {    
                                ?>
                                <li><span class="file"><a href="<?=$linha_file2['met_url'];?>" target="_blank"><?="{$linha_file2['met_nome']} - <b>".todatabr($linha_file2['met_data'])."</b>&nbsp;&nbsp;-&nbsp;&nbsp;{$linha_file2['met_hora']} Z";?></a></span></li>

                                <?php 
                                } 
                                ?>
                                </ul>

                            </li>
                            <? } 

                            $sql_raiz1 = "SELECT * FROM meteoro WHERE status='1' AND met_are_id='{$linha_raiz['met_are_id']}' ORDER BY met_id DESC";
                            $res_raiz1 = sql($sql_raiz1);
                            while($linha_raiz1 = mysql_fetch_array($res_raiz1)) {
                            ?>
                                <li><span class="file"> <a href="<?=$linha_raiz1['met_url'];?>" target="_blank"><?="{$linha_raiz1['met_nome']} - <b>".todatabr($linha_raiz1['met_data'])."</b>&nbsp;&nbsp;-&nbsp;&nbsp;{$linha_raiz1['met_hora']} Z";?></a></span></li>
                            <?php
                            }
                            ?>

                        </ul>

                    </li>
                    <?php
                    }
                    ?>
                </ul>

            </div>
            
            
            
        </p>
    </div>
    
    <div id="meteoro2" class="tab-pane fade">
        
        <p>
            
            <div id="div" style="width: 98%">

                <table class="table table-striped table-bordered table-hover">

                    <tr>
                        <th><?= $t_nome; ?></th>
                        <th width="50" align="center"><?= $t_manha; ?></th>
                        <th width="50" align="center"><?= $t_tarde; ?></th>
                        <th width="50" align="center"><?= $t_noite; ?></th>
                    </tr>

                    <?php
                    $res_status = sql("SELECT * FROM meteorostatus WHERE status='1' ORDER BY met_sta_nome");
                    while($linha_status = mysql_fetch_array($res_status)){
                        $data = $linha_status['met_sta_data'];
                        $hora = $linha_status['met_sta_hora'];
                    ?>

                    <tr>

                        <td><?=$linha_status['met_sta_nome'];?></td>
                        <td>
                            <div style='width: 25px;height: 25px; background-color:#<?=$linha_status['met_sta_m'];?>'></div>
                        </td>
                        <td>
                            <div style='width: 25px;height: 25px; background-color:#<?=$linha_status['met_sta_t'];?>'></div>
                        </td>
                        <td>
                            <div style='width: 25px;height: 25px; background-color:#<?=$linha_status['met_sta_n'];?>'></div>
                        </td>

                    </tr>
                    <?php } ?>
                    <tr>
                        <td colspan="4">
                        <?= $t_atualiza; ?> <?=todatabr($data)."&nbsp;&nbsp;$hora Z"; ?>
                        </td>
                    </tr>

                </table>

            </div>
              
        </p>
        
    </div>
    
    
    <div id="meteoro3" class="tab-pane fade">
        
        <p>
            
            <div id="div" style="width: 98%">

                <table class="table table-striped table-bordered table-hover">

                    <tr>
                        <th><?= $t_nome; ?></th>
                        <th width="50" align="center"><?=  $t_titulo_manha; ?></th>
                        <th width="50" align="center"><?=  $t_tarde; ?></th>
                        <th width="50" align="center"><?=  $t_noite; ?></th>
                    </tr>

                    <?php
                    $res_status = sql("SELECT * FROM meteorocampo WHERE status='1' ORDER BY met_cam_nome");
                    while($linha_status = mysql_fetch_array($res_status)){
                        $data = $linha_status['met_cam_data'];
                        $hora = $linha_status['met_cam_hora'];
                    ?>

                    <tr>

                        <td><?=$linha_status['met_cam_nome'];?></td>
                        <td>
                            <div style='width: 25px;height: 25px; background-color:#<?=$linha_status['met_cam_m'];?>'></div>
                        </td>
                        <td>
                            <div style='width: 25px;height: 25px; background-color:#<?=$linha_status['met_cam_t'];?>'></div>
                        </td>
                        <td>
                            <div style='width: 25px;height: 25px; background-color:#<?=$linha_status['met_cam_n'];?>'></div>
                        </td>

                    </tr>
                    <?php } ?>
                    <tr>
                        <td colspan="4">
                        <?= $t_atualiza; ?> <?=todatabr($data)."&nbsp;&nbsp;$hora Z"; ?>
                        </td>
                    </tr>

                </table>

            </div>
              
        </p>
        
    </div>

</div>